/*
   Copyright (c) [2023] [魔凤啸天]
   [MFUI] is licensed under Mulan PSL v2.
   You can use this software according to the terms and conditions of the Mulan PSL v2. 
   You may obtain a copy of Mulan PSL v2 at:
            http://license.coscl.org.cn/MulanPSL2 
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
   See the Mulan PSL v2 for more details.  
*/
#pragma once
#include "core.hpp"
#include<SDL2/SDL.h>

namespace MFUI{
	struct DrawNode{
		virtual ~DrawNode();
		virtual void draw(Renderer* r)=0;
	};
	struct SetColor:DrawNode{
		SDL_Color color;

		~SetColor();
		void draw(Renderer* r)override;
		SetColor(SDL_Color c);	
	};
	struct DrawPoint:DrawNode{
		SDL_Point p;

		~DrawPoint();
		void draw(Renderer* r)override;
		DrawPoint(SDL_Point& p);
	};
	struct DrawLine:DrawNode{
		SDL_Point x,y;

		~DrawLine();
		void draw(Renderer* r)override;
		DrawLine(SDL_Point& x,SDL_Point& y);
	};
	struct DrawRect:DrawNode{
		SDL_Rect rect;

		~DrawRect();
		void draw(Renderer* r)override;
		DrawRect(SDL_Rect& r);
	};
	struct FillRect:DrawNode{
		SDL_Rect rect;

		~FillRect();
		void draw(Renderer* r)override;
		FillRect(SDL_Rect& r);
	};
	struct DrawTexture:DrawNode{
		SDL_Texture* texture;//仅引用
		SDL_Rect src,dst;
		Uint8 alpha;
		
		~DrawTexture();
		DrawTexture(SDL_Texture* t,SDL_Rect& src,SDL_Rect& dst,Uint8 a);
		void draw(Renderer* r)override;
	};
	struct DrawTextureEx:DrawTexture{
		SDL_RendererFlip flip;
		double angle;
		SDL_Point center;

		~DrawTextureEx();
		void draw(Renderer* r)override;
		DrawTextureEx(SDL_Texture* t,SDL_Rect& src,SDL_Rect& dst,
		SDL_RendererFlip f,double& degree,SDL_Point& center,Uint8 a);
	};
	struct DrawFPoint:DrawNode{
		SDL_FPoint p;

		~DrawFPoint();
		void draw(Renderer* r)override;
		DrawFPoint(SDL_FPoint& p);
	};
	struct DrawFLine:DrawNode{
		SDL_FPoint x,y;

		~DrawFLine();
		void draw(Renderer* r)override;
		DrawFLine(SDL_FPoint& x,SDL_FPoint& y);
	};
	struct DrawFRect:DrawNode{
		SDL_FRect rect;

		~DrawFRect();
		void draw(Renderer* r)override;
		DrawFRect(SDL_FRect& r);
	};
	struct FillFRect:DrawNode{
		SDL_FRect rect;

		~FillFRect();
		void draw(Renderer* r)override;
		FillFRect(SDL_FRect& r);
	};
	struct DrawFTexture:DrawNode{
		SDL_Texture* texture;//仅引用
		SDL_Rect src;
		SDL_FRect dst;
		Uint8 alpha;
		
		~DrawFTexture();
		DrawFTexture(SDL_Texture* t,SDL_Rect& src,SDL_FRect& dst,Uint8 a);
		void draw(Renderer* r)override;
	};
	struct DrawFTextureEx:DrawFTexture{
		SDL_RendererFlip flip;
		double angle;
		SDL_FPoint center;

		~DrawFTextureEx();
		void draw(Renderer* r)override;
		DrawFTextureEx(SDL_Texture* t,SDL_Rect& src,SDL_FRect& dst,
		SDL_RendererFlip f,double& degree,SDL_FPoint& center,Uint8 a);
	};
}